import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TelCallRecordVO, TelCallRecordForm, TelCallRecordQuery } from '@/api/device/telCallRecord/types';

/**
 * 查询通话记录列表
 * @param query
 * @returns {*}
 */

export const listTelCallRecord = (query?: TelCallRecordQuery): AxiosPromise<TelCallRecordVO[]> => {
  return request({
    url: '/device/telCallRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询通话记录详细
 * @param id
 */
export const getTelCallRecord = (id: string | number): AxiosPromise<TelCallRecordVO> => {
  return request({
    url: '/device/telCallRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增通话记录
 * @param data
 */
export const addTelCallRecord = (data: TelCallRecordForm) => {
  return request({
    url: '/device/telCallRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改通话记录
 * @param data
 */
export const updateTelCallRecord = (data: TelCallRecordForm) => {
  return request({
    url: '/device/telCallRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除通话记录
 * @param id
 */
export const delTelCallRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/telCallRecord/' + id,
    method: 'delete'
  });
};
